<script setup>

import {ref, onMounted} from "vue";
import {getList_Category} from "@/api/category";

const categoryData = ref([])
const initData = async () => {
  const res = await getList_Category()
  if (res.code === 200) {
    categoryData.value = res.data
  }
}
//
onMounted(() => {
  initData()
})

const openEdit = ref(false)
const Edit = () => {
  openEdit.value = true
}
</script>

<template>
  <el-table :data="categoryData">
    <el-table-column prop="name" label="分类名称" align="center"/>
    <el-table-column prop="description" label="分类描述" align="center"/>
    <el-table-column prop="name" label="分类名称">
      <template #default>
        <el-button type="primary" @click="Edit">编辑</el-button>
        <el-button type="danger">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <!--  查询进行回调-->
  <el-dialog v-model="openEdit">

  </el-dialog>
</template>

<style scoped>

</style>
